﻿using System;
using System.Net;
using System.Windows;

namespace SilverlightClientLibrary.Messages
{
    public class NewClientMessage : Message
    {
        public byte ClientAddedId { get; private set; }

        public NewClientMessage(byte clientBeingAddedId, int bufferSize)
            : base(bufferSize)
        {
            ClientAddedId = clientBeingAddedId;
        }

        public override byte[] Encode()
        {
            byte[] retArr = new byte[this.BufferSize];
            retArr[0] = (byte)MessageId.NewClientMessage;
            retArr[2] = ClientAddedId;

            return retArr;
        }

        public override Message Decode(byte[] bytes)
        {
            ClientAddedId = bytes[2];
            return this;
        }
    }
}
